package com.android.volley.http;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Objects;

public class StringBody implements ContentBody{

    private final byte[] mContent;

    public StringBody(String content) {
        Objects.requireNonNull(content);
        this.mContent = content.getBytes();
    }

    @Override
    public void writwTo(OutputStream out) throws IOException {
        out.write(mContent);
    }

    @Override
    public String getContentType() {
        return TYPE_TEXT_CHARSET;
    }

    @Override
    public String getContentTransferEncoding() {
        return BIT_ENCODING;
    }

    @Override
    public String getFileName() {
        return "";
    }
}
